import Vue from 'vue'
import App from './App'
import router from './router'
import {
  Toast,
  Swipe,
  SwipeItem,
  Progress,
  Loading,
  Uploader,
  Button,
  Calendar,
  Overlay,
  Dialog,
  Popup,
  Cascader,
  Tab,
  Tabs,
  PullRefresh,
  Switch,
  List,
  CountDown,
  IndexBar,
  IndexAnchor,
  Lazyload,
  Popover,
  NoticeBar,
  Image as VanImage,
} from "vant"
import axios from "axios"
import VueScroller from 'vue-scroller'
import store from "./store"
import $ from './assets/js/index'
import {
  NumberKeyboard
} from 'vant';
import VueClipboard from 'vue-clipboard2'
import {
  Area
} from 'vant';
import getBankcardinfo from 'bankcardinfo'
import less from 'less'
import lottie from 'vue-lottie';
Vue.component('lottie', lottie)
// import vConsole from 'vConsole'
Vue.prototype.$getBankcardinfo = getBankcardinfo
// Vue.prototype.$vConsole = new vConsole()
import Meta from 'vue-meta'
import {
  vueBaberrage
} from 'vue-baberrage'

Vue.use(vueBaberrage) //弹幕
Vue.use(less)
Vue.use(Meta)
VueClipboard.config.autoSetContainer = true
Vue.use(VueClipboard)
Vue.use(VueScroller)
Vue.prototype.$ = $

Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  // if (to.path === "/Festival") {
  //   next({
  //     path: '/recharge_wx', 
  //   })
  // }
  next()
})
//全局自定义点击事件v-debounce
Vue.directive('debounce', {
  inserted: function (el, binding) {
    let timer
    el.addEventListener('click', () => {
      if (timer) {
        clearTimeout(timer)
      }
      timer = setTimeout(() => {
        binding.value()
      }, 300)
    })
  }
})
Vue.use(Toast).use(Swipe).use(SwipeItem).use(Progress).use(NumberKeyboard).use(Area).use(Dialog).use(Popup).use(Cascader)
  .use(Loading).use(Uploader).use(Button).use(Calendar).use(Overlay).use(Tab).use(Tabs).use(PullRefresh).use(Switch).use(List)
  .use(CountDown).use(IndexBar).use(IndexAnchor).use(Lazyload).use(Popover).use(NoticeBar).use(VanImage);
Vue.use(Lazyload, {
  lazyComponent: true,
})
axios.defaults.timeout = 5000
// axios.defaults.baseURL = "http://testapi2.xunyinjiaoyou.com" //测试接口
axios.defaults.baseURL = "https://h5.xunyinjiaoyou.com" //正式接口


Vue.prototype.$axios = axios


new Vue({
  el: '#app',
  router,
  store,
  components: {
    App
  },
  template: '<App/>'
})